import sys 
sys.path.append('./gen-py/parse')
 
from Parse import *
from thrift import Thrift 
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
import requests
 
try:
    transport = TSocket.TSocket('localhost', 9234)
    #transport = TTransport.TBufferedTransport(transport)
    #http://www.it1352.com/471377.html
    transport = TTransport.TFramedTransport(transport)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    client = Client(protocol)
    transport.open()
 
    print('start')
    #res = requests.get('http://www.baidu.com')
    xml = client.parseHtml2Xml('test')
    print( xml )
    transport.close()
except Thrift.TException as e:
    print ('exceptino')
    print( e)

